<?php

namespace App\Model;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * @property integer $id
 * @property string $name
 * @property string $cost
 * @property string $start
 * @property string $end
 * @property string $day
 * @property string $city
 * @property array $staff_list
 * @property integer $pid
 * @property integer $city_level
 * @property integer $sex
 * @property array $date
 * @property  integer $xmid
 * @property  integer $is_del
 */
class OAFinanceClv extends Model
{
    protected $table = 'finance_clv';

    public $timestamps = false;

    protected $fillable = [
        'name','cost','start','end',
        'day','city','staff_list','pid',
        'city_level','sex','xmid','is_del'
    ];
    protected $attributes = ['staff_list'=>'array'];
    protected $casts = ['staff_list'=>'array'];
    protected $hidden = [
        'start','end','pid'
    ];
    protected $appends = ['date','inputVisible','inputValue'];

    public function getDateAttribute()
    {
        return [
            Carbon::parse($this->start)->format('Y-m-d'),
            Carbon::parse($this->end)->format('Y-m-d'),
        ];
    }

    public function getInputVisibleAttribute()
    {
        return false;
    }
    public function getInputValueAttribute()
    {
        return '';
    }

}
